﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crosland.Automotriz.Core;
using System.Data;

namespace Crosland.Automotriz.Data.Dao.Linq
{
    public class clsT_Mae_MonedaDAO
    {

        private readonly AutomotrizEntities ContextoDeObjs = new AutomotrizEntities();

        public IEnumerable<Object> ListarMonedas()
        {
            try
            {
                IEnumerable<Object> Lista = new List<Object>();

                var q=from c in ContextoDeObjs.T_MAE_MONEDA
                      select c;
                Lista = q.ToList();
                return Lista;

            }
            catch (Exception)
            {
                
                throw;
            }
        }

        public List<T_MAE_MONEDA> MonedaXCta(int idCta)
        {
            List<T_MAE_MONEDA> lista = new List<T_MAE_MONEDA>();

            var q = from c in ContextoDeObjs.T_MAE_MONEDA
                    join d in ContextoDeObjs.T_MAE_BANCO_CUENTA
                    on c.ID_MONEDA equals d.ID_MONEDA
                    where d.ID_BANCO_CUENTA == idCta
                    select c;
            lista = q.ToList();

            return lista;

        }

        public List<T_MAE_MONEDA> Listar() 
        {
            var q = from c in ContextoDeObjs.T_MAE_MONEDA
                    orderby c.NOM_MONEDA
                    select c;
            return q.ToList();
        }

    }
}
